﻿using Microsoft.Extensions.Logging;
using Orleans;
using Orleans.Concurrency;
using Orleans.Core;
using Orleans.Runtime;
using System;
using System.Threading.Tasks;

namespace Sample.GrainService
{
    [Reentrant]
    public class DataService : Orleans.Runtime.GrainService, IDataService
    {
        readonly IGrainFactory GrainFactory;

        public DataService(IServiceProvider services, IGrainIdentity id, Silo silo, ILoggerFactory loggerFactory, IGrainFactory grainFactory) : base(id, silo, loggerFactory)
        {
            this.GrainFactory = grainFactory;
        }

        public override Task Init(IServiceProvider serviceProvider)
        {
            return base.Init(serviceProvider);
        }

        public override async Task Start()
        {
            await base.Start();
        }

        public override Task Stop()
        {
            return base.Stop();
        }

        public Task<int> MyMethod()
        {
            Console.WriteLine(  "***************************************asdasdasdasd**************************");
            throw new Exception("error info   aaa.");
        }
    }
}
